import 'dart:io';

import 'package:bpb/routers/routers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'bindings/init_binding.dart';
import 'i18n/language.dart';


Future<void> main() async {

  WidgetsFlutterBinding.ensureInitialized();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {

  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(375, 812),
      builder: () {
        return GetMaterialApp(
          debugShowCheckedModeBanner: false,
          translations: Messages(),
          initialBinding: InitBinding(),
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          // locale: WidgetsBinding.instance.window.locales,
          // localeResolutionCallback: (deviceLocale, supportedLocales) {
          //   Get.updateLocale(deviceLocale!);
          //   // print("当前系统语言：------>${deviceLocale!.countryCode}");
          // },
          locale: Locale('en', 'US'),
          // locale: const Locale('zh','CN'),
          initialRoute: '/',
          getPages: AppPage.routes,
        );
      },
    );
  }
}
